-# locals: instance

%ul.tree-structure.simple
  %li.tab-title-holder
    %h3.tab-title
      Controls mitigating this Risk
      %a.widgetbtn.pull-right{ :href => list_edit_flow_control_risks_path(:risk_id => instance.id), :'data-toggle' => 'modal-ajax-relationship-selector', :'data-modal-reset' => 'reset', :'data-list-target' => 'refresh', :rel => 'tooltip', :'data-placement' => 'left', :title => 'Link controls to this risk', :'data-modal-class' => 'modal-wide' }
        %i.grcicon-link
        
  -instance.controls.each_with_index do |control, i|
    -id_prefix = "control-#{i}"
    -summary_toggle_target = "#{id_prefix}-summary"
    %li.control{ :'data-object-id' => i, :'data-object-type' => "control" }
      .item-main
        .item-title
          .row-fluid
            =render :partial => 'object_leaf', :locals => { :instance => control, :notes_attr => "" }
          .item-actions
            %a.btn.btn-mini{ "rel" => "tooltip", "data-placement" => "left", "title" => "Go to this object's page", :href => flow_control_path(control.id) }
              %i.grcicon-goto
